//
//  MTRecordCell.m
//  met
//
//  Created by 李晓俊 on 2019/5/11.
//  Copyright © 2019 李晓俊. All rights reserved.
//

#import "MTRecordCell.h"

@implementation MTRecordCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
+(MTRecordCell *)cellWithTableView:(UITableView *)tableview{
    static NSString* ID =  @"MTRecordCell";
    MTRecordCell* cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[[NSBundle mainBundle] loadNibNamed:NSStringFromClass(self) owner:nil options:nil] lastObject];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    //    cell.backgroundColor = [UIColor clearColor];
    
    return cell;
}

- (void)setModel:(RecordModel *)model
{
    _model = model;
//     0:步数兑换|1:邀请获得 2签到获得 3答题减少 4添加故事获得 5答对NPC题目获得
    NSArray *ar = @[@"步数兑换",@"邀请获得",@"签到获得",@"答题减少",@"添加故事获得",@"答对NPC题目获得",@"充值"];
    NSInteger type = [[NSString stringWithFormat:@"%@",model.exchangeType] integerValue];
    if (type < ar.count) {
        self.content.text = [ar objectAtIndex:type];
    }
    NSString *fuhao = @"+";
    if (type ==3) {
        fuhao = @"-";
    }
    self.time.text = [NSString stringWithFormat:@"%@",model.createTime];
    self.count.text = [NSString stringWithFormat:@"%@%@",fuhao,model.ticketNum];
}
@end
